<!DOCTYPE html>
<!-- Ported from the OpenGL Samples Pack: github.com/g-truc/ogl-samples/blob/master/tests/gl-320-draw-instanced.cpp -->
<html lang="en">

<head>
    <title>WebGL 2 Samples - draw_instanced</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div id="info">WebGL 2 Samples - draw_instanced</div>
    <p id="description">
        This samples demonstrates the use of gl.DrawArraysInstanced()
    </p>

    <script id="vs" type="x-shader/x-vertex">
        #version 300 es
        #define POSITION_LOCATION 0
        #define COLOR_LOCATION 1
        
        precision highp float;
        precision highp int;

        layout(location = POSITION_LOCATION) in vec2 pos;
        layout(location = COLOR_LOCATION) in vec4 color;
        flat out vec4 v_color;

        void main()
        {
            v_color = color;
            gl_Position = vec4(pos + vec2(float(gl_InstanceID) - 0.5, 0.0), 0.0, 1.0);
        }
    </script>

    <script id="fs" type="x-shader/x-fragment">
        #version 300 es
        precision highp float;
        precision highp int;

        flat in vec4 v_color;
        out vec4 color;

        void main()
        {
            color = v_color;
        }
    </script>

    <script type="module" src="./draw_instanced.ts"></script>
</body>

</html>